package com.zxy.health.controller;

import com.zxy.health.dao.InputSchoolDao;
import com.zxy.health.rsp.InputSchoolRsp;
import com.zxy.health.service.InputSchoolService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/inputschool")
public class InputSchoolController {

    @Autowired
    InputSchoolService inputSchoolService;

    @RequestMapping("/toInputSchool")
    public String toInputSchool(){
        return "inputschool";
    }

    @RequestMapping("/inputSchool")
    @ResponseBody
    public String inputSchool(
            @RequestParam("schoolid") String schoolId
    ){
        return inputSchoolService.addStudentInputschool(schoolId);
    }

    @RequestMapping("/outputSchool")
    @ResponseBody
    public String outputSchool(
            @RequestParam("schoolid") String schoolId
    ){
        return inputSchoolService.addStudentOutputschool(schoolId);
    }

    @RequestMapping("/getRecord")
    @ResponseBody
    public InputSchoolRsp getRecord(
            @RequestParam("schoolid") String schoolId

    ){
        InputSchoolRsp inputSchoolRsp = new InputSchoolRsp();
        inputSchoolRsp.setList(inputSchoolService.getInputSchoolRecordById(schoolId));
        return inputSchoolRsp;
    }
}
